<!--设置模块唯一ID-->
<div id="cyy_datingshangpuguanli_zulin_add">
<!--标题、面包屑-->
<section class="content-header">
    <h1>
        租赁
    </h1>
    <ol class="breadcrumb">
        <li><a href="#"><i class="fa fa-dashboard"></i> 首页</a></li>
        <li>产业园</li>
        <li>大厅商铺管理</li>
        <li>租赁</li>
        <li class="active">添加租赁</li>
    </ol>
</section>
<!--列表-->
<section class="content">

</section>
<!--添加、修改弹出层-->
<script type="text/template" data-for="tp_editor">
    <form role="form" class="form-horizontal">
        <div class="u-area">
            <div class="form-group">
                <label class="col-sm-2 control-label">编号：<%=data.p1?data.p1:''%></label>
                <div class="col-sm-4">
                    <input type="text" class="form-control"
                           value="<%=data.p1?data.p1:''%>" disabled>
                </div>

                <label class="col-sm-2 control-label">状态</label>
                <div class="col-sm-4">
                    <select class="form-control" name="p2">
                        <option>草稿</option>
                        <option>已缴费</option>
                        <option>未交费</option>
                        <option>已趸交</option>
                        <option>已签署</option>
                    </select>
                </div>
            </div>
        </div>
        <div class="u-box">
            <div class="u-box-header">
                <h3>操作人信息</h3>
            </div>
            <div class="u-area">
                <div class="form-group">
                    <label class="col-sm-2 control-label">操作人</label>
                    <div class="col-sm-4">
                        <input type="text" class="form-control" name="p3"
                               value="<%=data.p3?data.p3:''%>">
                    </div>

                    <label class="col-sm-2 control-label">当前时间</label>
                    <div class="col-sm-4">
                        <input type="text" class="form-control" name="p4"
                               value="<%=data.p4?data.p4:''%>">
                    </div>
                </div>
            </div>
        </div>
        <div class="u-box">
            <div class="u-box-header">
                <h3>摊位信息</h3>
            </div>
            <div class="u-area">
                <div class="u-area">
                    <div class="form-group">
                        <label class="col-sm-2 control-label">摊位号</label>
                        <div class="col-sm-10">
                            <input type="text" class="form-control" name="p5"
                                   value="<%=data.p5?data.p5:''%>">
                        </div>
                    </div>

                    <div class="form-group">
                        <label class="col-sm-2 control-label">单价</label>
                        <div class="col-sm-4">
                            <input type="text" class="form-control" name="p10"
                                   value="<%=data.p10?data.p10:''%>">
                        </div>

                        <label class="col-sm-2 control-label">面积</label>
                        <div class="col-sm-4">
                            <input type="text" class="form-control" name="p10"
                                   value="<%=data.p10?data.p10:''%>">
                        </div>
                    </div>

                    <div class="form-group">
                        <label class="col-sm-2 control-label">半年租金</label>
                        <div class="col-sm-4">
                            <input type="text" class="form-control" name="p10"
                                   value="<%=data.p10?data.p10:''%>">
                        </div>

                        <label class="col-sm-2 control-label">全年租金</label>
                        <div class="col-sm-4">
                            <input type="text" class="form-control" name="p10"
                                   value="<%=data.p10?data.p10:''%>">
                        </div>
                    </div>
                </div>

                <div class="u-box-header">
                    <h3>登记信息</h3>
                </div>
                <div class="u-area">
                    <div class="form-group">
                        <label class="col-sm-2 control-label">客户姓名</label>
                        <div class="col-sm-4">
                            <input type="text" class="form-control" name="p10"
                                   value="<%=data.p10?data.p10:''%>">
                        </div>

                        <label class="col-sm-2 control-label">客户电话</label>
                        <div class="col-sm-4">
                            <input type="text" class="form-control" name="p10"
                                   value="<%=data.p10?data.p10:''%>">
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-sm-2 control-label">身份证号</label>
                        <div class="col-sm-4">
                            <input type="text" class="form-control" name="p10"
                                   value="<%=data.p10?data.p10:''%>">
                        </div>

                        <label class="col-sm-2 control-label">籍贯</label>
                        <div class="col-sm-4">
                            <input type="text" class="form-control" name="p10"
                                   value="<%=data.p10?data.p10:''%>">
                        </div>
                    </div>

                    <div class="form-group">
                        <label class="col-sm-2 control-label">是否个体</label>
                        <div class="col-sm-4">
                            <select class="form-control">
                                <option value="1">是</option>
                                <option value="0">否</option>
                            </select>
                        </div>

                        <label class="col-sm-2 control-label">经营项目</label>
                        <div class="col-sm-4">
                            <input type="text" class="form-control" name="p10"
                                   value="<%=data.p10?data.p10:''%>">
                        </div>
                    </div>

                    <div class="border"></div>

                    <div class="form-group">
                        <label class="col-sm-2 control-label">合同有效期</label>
                        <div class="col-sm-4">
                            <div class="input-group date">
                                <div class="input-group-addon">
                                    <i class="fa fa-calendar"></i>
                                </div>
                                <input type="text" class="form-control pull-right" data-plugin="date" name="p11"
                                       value="<%=data.p11?data.p11:''%>">
                            </div>
                        </div>
                        <label class="col-sm-2 control-label">下半年缴费时间</label>
                        <div class="col-sm-4">
                            <input type="text" class="form-control" name="p15"
                                   value="<%=data.p15?data.p15:''%>">
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-sm-2 control-label">终止日期</label>
                        <div class="col-sm-4">
                            <div class="input-group date">
                                <div class="input-group-addon">
                                    <i class="fa fa-calendar"></i>
                                </div>
                                <input type="text" class="form-control pull-right" data-plugin="date" name="p11"
                                       value="<%=data.p11?data.p11:''%>">
                            </div>
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-sm-2 control-label">备注</label>
                        <div class="col-sm-10">
                            <textarea class="form-control">
                                <%=data.p16?data.p16:''%>
                            </textarea>
                        </div>
                    </div>
                </div>
            </div>
        </div>
        <div class="box-footer">
            <button type="submit" class="btn btn-primary pull-right">创建</button>
        </div>
    </form>
</script>

<script>
    USEN(function () {
        //模块ID(全系统唯一)
        var tableId = "#cyy_datingshangpuguanli_zulin";
        var id = "#cyy_datingshangpuguanli_zulin_add";

        //定义页面变量
        var $el = $(id);
        var $editor = $el.find('script[data-for=tp_editor]');

        $.ajax({
            url:"./simdata/common_add_action.json",
            success:function(data){
                $el.find(".content").html(function(){
                    return _.template($editor.html())({
                        data:data
                    })
                });

                //提交表单
                $el.find("form").ajaxForm({
                    url: './simdata/common_add_action.json',
                    beforeSubmit: function (data) {
                        //console.log("数据提交之前.")
                    },
                    success: function (data, state, obj) {
                        USEN.notifyAlert({
                            title: "提示:",
                            content: '操作成功,刷新列表'
                        });
                        USEN.getDatatable(tableId + ' table.table').ajax.reload();
                        USEN.closeActiveTab();
                    }
                });

                $el.find("select").css('width','98%').select2({
                    dropdownParent:$el
                });
                $el.find("input[data-plugin=date]").datepicker({
                    autoclose: true
                });
            }
        })

    });
</script>
</div>